package objectsDiagram;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JPanel;

public class GatePanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JButton noneButton;
	private JButton xorButton;
	private JButton andButton;
	private JButton orButton;

	public GatePanel() {
		super();
		initialize();
	}

	private void initialize() {
		this.setSize(300, 200);
		GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
		GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		this.setLayout(new GridBagLayout());
		//this.setSize(new Dimension(175, 98));
		this.add(getAndButton(), gridBagConstraints);
		this.add(getXorButton(), gridBagConstraints1);
		this.add(getNoneButton(), gridBagConstraints2);
		this.add(getOrButton(), gridBagConstraints3);
		gridBagConstraints2.gridx = 0;
		gridBagConstraints2.gridy = 0;
		this.add(getNoneButton(), gridBagConstraints2);
		gridBagConstraints1.gridx = 1;
		gridBagConstraints1.gridy = 0;
		this.add(getOrButton(), gridBagConstraints1);
		gridBagConstraints3.gridx = 1;
		gridBagConstraints3.gridy = 1;
		this.add(getXorButton(), gridBagConstraints3);
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 1;
		this.add(getAndButton(), gridBagConstraints);
	}
	

	public JButton getOrButton() {
		if (orButton == null) {
			orButton = new JButton("OR");
			orButton.setPreferredSize(new Dimension(80, 50));
		}
		return orButton;
	}

	public JButton getAndButton() {
		if (andButton == null) {
			andButton = new JButton("AND");
			andButton.setPreferredSize(new Dimension(80, 50));
		}
		return andButton;
	}

	public JButton getXorButton() {
		if (xorButton == null) {
			xorButton = new JButton("XOR");
			xorButton.setPreferredSize(new Dimension(80, 50));
		}
		return xorButton;
	}

	public JButton getNoneButton() {
		if (noneButton == null) {
			noneButton = new JButton("NONE");
			noneButton.setPreferredSize(new Dimension(80, 50));
		}
		return noneButton;
	}

}
